import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ObjectVO, ObjectForm, ObjectQuery } from '@/api/system/object/types';

/**
 * 查询风险分析对象列表
 * @param query
 * @returns {*}
 */

export const listObject = (query?: ObjectQuery): AxiosPromise<ObjectVO[]> => {
  return request({
    url: '/system/object/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询风险分析对象详细
 * @param id
 */
export const getObject = (id: string | number): AxiosPromise<ObjectVO> => {
  return request({
    url: '/system/object/' + id,
    method: 'get'
  });
};

/**
 * 新增风险分析对象
 * @param data
 */
export const addObject = (data: ObjectForm) => {
  return request({
    url: '/system/object',
    method: 'post',
    data: data
  });
};

/**
 * 修改风险分析对象
 * @param data
 */
export const updateObject = (data: ObjectForm) => {
  return request({
    url: '/system/object',
    method: 'put',
    data: data
  });
};

/**
 * 删除风险分析对象
 * @param id
 */
export const delObject = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/object/' + id,
    method: 'delete'
  });
};
